<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
	<script type="text/javascript">
       window.onload=function()      
		{
			 var oEmail=document.getElementById('email');
			 var oBtn=document.getElementById('btn');

			 oBtn.onclick=function(){
			 	  //yyx219@qq.com
                  var re=/^\w+@[a-z0-9]+\.[a-z]+$/i;

                  if (re.test(oEmail.value)) {
                  	alert('合法');
                  }else{
                  	alert('非法');
                  }
			 }

		}

	</script>
</head>
<body>
	<input type="text" name="" id="email">
	<input type="button" id="btn" value="验证邮箱" name="">
</body> 
</html>